<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>css</title>
  <!-- <style>
    *{
      margin: 0; 
      padding:0; 
    }
    body{
      width: 100vw;
      height: 100vh;
      display: flex;
      align-items: center;
    }
    .out{
      /* position: absolute;
      top: 50%; */
      background-color: darkorange;
      /* transform: translateY(-50%); */
      margin-left: 10px;
      margin-right: 10px;
      width: 100%;
      font-style: 20px;
    }
    .in{
      text-align: center;
      padding: 25% 0;
    }
  </style> -->
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    body {
      width: 100vw;
      height: 100vh;
      display: flex;
      align-items: center;
    }

    .out {
      /* position: absolute; top: 50%;
      transform: translateY(-50%);  */
      background-color: blue;
      width: 100%;
      margin-left: 10px;
      margin-right: 10px;
      text-align: center;
      font-size: 20px;
    }

    .in {
      /* padding 百分比 相对于自己的 宽度来计算的 */
      height: 0;
      padding: 25% 0;
    }
  </style>
</head>

<body>
  <div class="out">
    <div class="in">
      A
    </div>
  </div>
</body>

</html>